﻿namespace OpenLS.Spreadsheet.Formats.Biff.Records
{
    internal abstract class Boolean16Record: BiffRecord
    {
        protected bool _value;
        protected override sealed void ReadContent(BiffReaderContext context, int length)
        {
            _value = context.ReadUInt16() != 0;
        }

        internal override sealed void WriteContent(BiffWriterWorkbookContext context)
        {
            ushort u = (ushort) (_value ? 1 : 0);
            context.Writer.Write(u);
        }
    }
}